package com.dailyblue.java.thread;

import java.util.concurrent.Callable;

// 线程的实现方式2⃣️  任务,有返回结果
public class DemoC implements Callable<String> {
    @Override
    public String call() throws Exception {
        // 获取当前运行线程
        Thread thread = Thread.currentThread();
        for (int i = 0; i < 20; i++) {
            System.out.println(thread.getName() + "运行了:" + i);
        }
        return thread.getName() + "线程";
    }
}
